class Animal {
    name: string;
    age: number;
    constructor(name: string, age: number) {
        this.name = name;
        this.age = age;
    }
    sex: string = '男'

    jump(str: string): void {
        console.log(str);
        console.log('跳了一下');
    }
    run(num: number): number {
        console.log('xxx');
        console.log(num);
        return num
    }
    static song(): any {
        console.log('新冠结束了！！');
    }
    static color: string = '黄种人'

}
let cat = new Animal('喵喵', 1);
console.log(cat);
cat.jump('111');
let dog = new Animal('dahuang', 11);
console.log(dog);
console.dir(Animal);
Animal.song();
console.log(Animal.color);

class Person extends Animal {
    constructor(name: string, age: number) {
        super(name, age)
    }
    jump(str: string): void {
        super.jump(str);
    }
    static song(): any {
        super.song();
    }

}

let liming = new Person('liming', 111);
console.log(liming);

class SunWei {
    public name: string;
    private age: number;
    protected sex: string;
    readonly hobby: string;
    constructor(name: string, age: number, sex: string, hobby: string) {
        this.name = name;
        this.age = age;
        this.sex = sex;
        this.hobby = hobby
    }
    show(): void {
        console.log(this.name);
        console.log(this.age);
        console.log(this.sex);
    }
}

let xiaosunwei = new SunWei('宝宝', 10, '男', '欢乐斗地主');
console.log(xiaosunwei);
console.log(xiaosunwei.name);
xiaosunwei.show();

class SunWenWen extends SunWei {
    constructor(name: string, age: number, sex: string, hobby: string) {
        super(name, age, sex, hobby);
    }
    test(): void {
        console.log(this.sex);
    }
}
let Wen = new SunWenWen('宝贝儿', 5, '女', '振刀');
console.log(Wen);
Wen.test();
console.log(xiaosunwei.hobby);
console.log(xiaosunwei.hobby);



class XiaoLi {
    constructor(public name: string, public age: number) {
        this.name = name;
        this.age = age;
    }
}
let lili = new XiaoLi('zheshu', 10);
console.log(lili);


class ZhiLong {
    name: string = '志龙';
    hobby: string = '吃饭睡觉打豆豆';  
    get zlh(): string {
        return this.name + this.hobby;
    }
    set zlh(value) {
        console.log(value);
    }

}

let xiaozhilong = new ZhiLong();
console.log(xiaozhilong.zlh);
xiaozhilong.zlh = "肤白貌美大长腿";


abstract class Parent {
    abstract run();
    abstract jump();
}

class Son extends Parent {
    run() {
        console.log('子类当中的跑');
    }
    jump() {
        console.log('跳')
    }
}
let Danny = new Son();
Danny.run();
Danny.jump();
